#coding:utf-8
'''
create on 2017-07-22
@author:sandy
'''

from mj import mjConst,mjConfig
import logging
import time
from pycommon import Utils
from pycommon import Pack as packet

def xiPai(bankerSeat,eastSeat):
    return packet.pack("HBB",mjConst.CMD_GAME2C_XIPAI,bankerSeat,eastSeat)

def faPai(rand1,rand2,cards):
    length = len(cards)
    pack = packet.pack("HHHH",mjConst.CMD_GAME2C_FAPAI,rand1,rand2,length)
    for i in range(length):
        pack += packet.pack("H",cards[i])
    return pack

def daPai(seat,card,code = mjConst.MJ_ERR_OK):
    return packet.pack("HHHH",mjConst.CMD_GAME2C_PLAYCARD,seat,card,code)

def buPai(seat,card,buKind = mjConst.MO_PAI_NORMAL):
    return packet.pack("HHH",mjConst.CMD_GAME2C_BUPAI,card,buKind)

def noticeCpgh(chi,peng,gang,agang,hu):
    return packet.pack("HBBBBB",mjConst.CMD_GAME2C_CPGH,chi,peng,gang,agang,hu)

def cpgh(seat,info,cardIds):
    l = len(cardIds)
    ret = packet.pack("HBBB",mjConst.CMD_GAME2C_CPGH,seat,info,l)
    for i in range(l):
        ret += packet.pack("H",cardIds[i])
    return ret





if __name__ == '__main__':
    pass
